package com.ysxsoft.wdg.adapter.my;

import android.widget.ImageView;
import android.widget.TextView;

import com.bumptech.glide.Glide;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ysxsoft.wdg.R;
import com.ysxsoft.wdg.bean.response.FenOrderResponse;
import com.ysxsoft.wdg.util.ViewUtils;

public class JfOrderAdapter extends BaseQuickAdapter<FenOrderResponse.DataBean.ListBean,BaseViewHolder> {


    public JfOrderAdapter(int layoutResId) {
        super(layoutResId);
    }

    public void clear(){
        getData().clear();
        notifyDataSetChanged();
    }


    @Override
    protected void convert(BaseViewHolder helper, FenOrderResponse.DataBean.ListBean item) {

                Glide.with(mContext).load(item.getAvatar()).into((ImageView) helper.getView(R.id.iv_tx));
        helper.setText(R.id.tv_nick,item.getUsername());
        helper.setText(R.id.tv_fs_type,item.getLevle());

         Glide.with(mContext).load(item.getPic()).into((ImageView) helper.getView(R.id.iv_goods));
                helper.setText(R.id.tv_goods_name,item.getProduct_name());
                helper.setText(R.id.tv_num,"x"+item.getNum());
                helper.setText(R.id.tv_status, ""+item.getOrder_status());
                helper.setText(R.id.tv_hl,"获利:¥"+item.getL_price());

        TextView tvOldPrice = helper.getView(R.id.tv_old_money);
        ViewUtils.setDeletLine(tvOldPrice);
                tvOldPrice.setText(mContext.getString(R.string.price_rmb,item.getL_price()));
                helper.setText(R.id.tv_money,mContext.getString(R.string.price_rmb,item.getL_price()));//TODO:测试
    }
}
